refactor: split oversized Go files (>1000 LOC) for clarity#47
Merged
Conversation
Move Google Vertex AI tests into cloud_providers_vertex_test.go and AWS Bedrock tests into cloud_providers_bedrock_test.go. Azure and cross-provider tests remain in cloud_providers_test.go. Pure mechanical split, no behavior changes.
Move Chat/StreamChat tests into anthropic_chat_test.go and Ping, error, client-config, and feature tests into anthropic_features_test.go. Message builder, tool conversion, and shared helpers remain in anthropic_test.go. Pure mechanical split, no behavior changes.
Move StreamChat tests into openai_stream_test.go and Ping, compat, image-content, tool-result, and misc client tests into openai_misc_test.go. Helpers and core Chat tests remain in openai_test.go. Pure mechanical split, no behavior changes.
Move GuardrailError, ApplyGuardrails, GuardrailProvider, WithGuardrails option, integration, and enum-value tests into guardrails_provider_test.go. Core Guardrails, redaction, and rule-definition tests remain in guardrails_test.go. Pure mechanical split, no behavior changes.
Move node, alias, prompt-from, rate-limit, error-simulation, content-type, concurrency, and tree endpoint tests into integration_nodes_test.go. Shared mock providers, helpers, and health/chat/streaming/auth tests remain in integration_test.go. Pure mechanical split, no behavior changes.
Move OpenAI/OpenRouter enrichment and cloud-provider (Azure, Bedrock, Vertex, MiniMax) fetchers into fetchers_cloud.go, and the remaining per-provider fetchers into fetchers_providers.go. The registry, shared parsing/pricing/env helpers, and AWS SigV4 signing helpers remain in fetchers.go. Pure mechanical split, no behavior changes.
Move default catalog construction, legacy ModelCatalog conversion, and pricing/capability sanitization+validation helpers into v1_defaults.go. Schema types, parsing, validation, compilation, loading, and lookups remain in v1.go. Pure mechanical split, no behavior changes.
54abb57 to
24ddc02
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pure mechanical refactor for code clarity only. Splits every Go file over
1000 LOC into smaller, same-package files. Code is moved verbatim — no
behavior, API, or exported-symbol changes. Build tags and file-level
//nolintdirectives are preserved on the new files.Files split (before → after)
client/cloud_providers_test.gocloud_providers_vertex_test.go(612) +cloud_providers_bedrock_test.go(663)client/anthropic_test.goanthropic_chat_test.go(554) +anthropic_features_test.go(676)client/openai_test.goopenai_stream_test.go(287) +openai_misc_test.go(518)client/guardrails_test.goguardrails_provider_test.go(489)internal/api/integration_test.gointegration_nodes_test.go(509)catalog/live/fetchers.gofetchers_cloud.go(433) +fetchers_providers.go(577)catalog/v1.gov1_defaults.go(387)All resulting files are now well under 1000 LOC. No single function/literal
exceeded 1000 lines, so nothing had to be left oversized.
Grouping rationale
Chat vs StreamChat vs feature tests, endpoint families). Shared helpers
remain in the original file.
fetchers; default-catalog/legacy-conversion helpers). Registry, shared
helpers, and AWS SigV4 signing helpers stay in the original.
Verification
goimports -won all touched files.go vet,go test,golangci-lint run→ 0 issues.github.com/GrayCodeAI/eyrie):go build ./...,go vet ./...,go test ./...all pass.internal/sdk/go,github.com/GrayCodeAI/eyrie/sdk/go):go build/vet/test ./...pass (run withGOWORK=off).import "C"; modernc sqlite is pure Go).One conventional-commit per logical split (7 commits).
Made with Cursor